package com.itheima.blockingqueue;

import java.util.Iterator;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

public class Demo01 {

    public static void main(String[] args) {
        BlockingQueue<String> queue = new ArrayBlockingQueue<>(5);
        queue.add("坤坤1");
        queue.add("坤坤2");
        queue.add("坤坤3");
        queue.add("坤坤4");

        queue.remove("坤坤4");
        Iterator<String> iterator = queue.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next());
        }

        System.out.println("------------");
        for (String s : queue) {
            System.out.println(s);
        }
        queue.forEach(s -> System.out.println(s) );

    }
}
